var util = require('../../utils/util.js');
var utilMd5 = require('../../utils/md5.js');
var app = getApp();
var page = 1;
var inviteuid = '';

var hb_info = '';

var screen_w = 320;

var timer = '';

Page({
  data: {
    util: util,
    tc: 1,
    org_name: '',
    bottom_nav_data: [],
    isIphone_x: false,
    nav_bgColor: '#ffffff',

    screen_w: 320,
    tagTitle_bg_w: 40,

    view_order: '', //视图顺序
      logo_urls: '',//顶图
      swiperImgUrls: [],//轮播图
      swiperImgUrls2: [],//轮播图2
      swiperImgUrls3: [],//轮播图3
      gonggaoList: [],//公告
      topmenuInfos: [],//顶部分类菜单
      tietu_urls: '',//贴图区
      zixunfenlei: '', //咨询分类
      top_menu_bg_color: '#fafafa',//顶部菜单背景颜色
      top_menu_item_w: 70, //
      top_menu_img_w_h: 37.5,//顶部菜单图片宽高

      menu_item_w: 90, //
      menu_img_w_h: 37.5,//菜单图片宽高

      tuijianData:[],//店长推荐（置顶）
      tuijianOb: '',

      djJingxuanData: [],//冬季精选
      jingxuanOb: '',

      xinpin_data: [],//新品
      xinpinOb: '',

      goodsTypeArray: '',//商品分类区
      fenleiOb: '',

      mendian_data:'',//门店／经销商

      indicatorDots: true,
      autoplay: true,
      interval: 4000,
      duration: 600,
      startTime:0, 

      userInfo: null,
      token: '',
      loginuid:'',
      
      userphotos: [],

      isIphone:false,

      isShow: false,

      itemViewWidth: 105,
      itemViewHeight: 158,

      goodsImgView_h: 160,

      swiper_h: 160,

      contact_phone: '',

      hongbaoInfo: '',
      curTime: 0,
      colorIndex: 0,

      guanggao_link: '',

      gg_img_w: 290,
      gg_img_h: 290*4/3,

      markers: [{
        iconPath: "/images/map_sign.png",
        id: 0,
        latitude: 23.016357,
        longitude: 113.103185,
        width: 20,
        height: 35
      }],

      colorSet: '',

      animation:'',//广告动画
      screen_h: 480,


      AbanList: [],
      BbanList:[],
      guojibanList:[],
      fenlei0class: "font-weight:bold;color:#4595FD;",
      fenlei1class: "",
      fenlei2class: "",

      line0: "height:8rpx;",
      line2: "",
      line3: "",
 
  },

  onLoad: function (data) {
    console.log("xxxxxxxxxxxxxxxxxxxxxxx", data);
    var tc = app.get_tc();
    var that = this;
    that.setData({
      tc: tc,
    });
    wx.showLoading({
      title: tc == 1 ? '加載中' : '加载中',
      mask: 'true'
    });

    hb_info = '';
    //获取绑定orgid信息
    app.GetUserInfo(util.orgid, function (res) {
      console.log("绑定机构信息：", res);
      wx.setNavigationBarTitle({
        // title: res.uname,
        title: '鞋市开黑',
      });
      that.setData({
        org_name: res.uname
      })
    });
    
    //初始化底部导航
    var b_nav_data = app.getBottomNavData('shoes-index/shoes-index', function (data) {
      that.setData({
        bottom_nav_data: data,
        nav_bgColor: data[0].bgcolor
      });
    });

    wx.getSystemInfo({
      success: function (res) {
        var isiPhone = (res.model.indexOf('iPhone') >= 0);
        screen_w = res.windowWidth;
        var width = (res.windowWidth / 2) - (res.windowWidth / 8);
        var height = width + 1;
        var isIphone_x = (res.model.indexOf('iPhone X') >= 0);
        that.setData({
          tc: app.get_tc(),
          isIphone: isiPhone,
          isIphone_x: isIphone_x,
          screen_w: screen_w,
          screen_h: res.windowHeight,
          tagTitle_bg_w: (screen_w/320) * 40,
          itemViewWidth: width,
          itemViewHeight: height,
          goodsImgView_h: (screen_w - 30) / 2,
          swiper_h: screen_w / 2,
          top_menu_item_w: (screen_w - 24) / 4,
          top_menu_img_w_h: 37.5 * (screen_w / 320),

          menu_item_w: (screen_w - 24) / 4,
          menu_img_w_h: 70 * (screen_w / 320),

          gg_img_w: screen_w - 30,
          gg_img_h: (screen_w - 30) * 4 / 3,
        });
      }
    })

    util.api({
      data: {
        "publickey": util.publiccode,
        "ac": "wxcheck"
      },
      success: function (responseData) {
        that.setData({
          isShow: responseData.data.isShow
        });
      }
    });
 

    // 1 - 轮播图; 2 - 顶图; 3 - 顶部菜单; 4 - 精选区
    // 5 - 推荐区; 6 - 新品区; 7 - 分类区; 8 - 经销商／门店区
    util.api({
      data: {
        "publickey": util.publiccode,
        "ac": "areaorder",
        "uid": util.orgid
      },
      success: function (responseData) {
        console.log("视图顺序：", responseData.data)
        that.setData({
          view_order: responseData.data
        });

        //读取企业logo
        that.loadSwiperImage(2);
        //读取首页顶部菜单
        that.loadSwiperImage(3);
        //读取幻灯片图片链接
        that.loadSwiperImage(1);
        //读取精选数据
        that.loadSwiperImage(4);
        //读取推荐数据
        that.loadSwiperImage(5);
        //读取新品数据
        that.loadSwiperImage(6);
        //读取商品分类便签名
        that.loadSwiperImage(7);
        //读取门店
        that.loadSwiperImage(8);
        //读取幻灯片图片链接2
        that.loadSwiperImage(10);
        //读取幻灯片图片链接3
        that.loadSwiperImage(11);
        //读取幻咨询分类
        that.loadSwiperImage(12);
        //读取公告链接
        that.loadSwiperImage(13);
      }
    });
    
    //是否是从分享进来的
    inviteuid = data.inviteuid ? data.inviteuid : '';
    
    //读取登录用户信息
    app.LoginUserInfo(function(res){   
      console.log("登录用户信息：", res);
      if(res && res != -1){
        that.setData({
          loginuid: res.uid,
          token: res.token
        });
        //设置用户信息
        app.GetUserInfo(res.uid, function (res) {
          var up = '';
          if (res.photo){
            up = res.photo.split(',');
          }
          //更新数据
          that.setData({
            userInfo:res,
            userphotos: up
          })    

        });
      }       
    }, inviteuid);

    //获取关于等信息
    app.getAllAbout('contact', function(res){
      that.setData({
        contact_phone: res
      })
    });

    if (util.orgid == '12545' || util.orgid == '16535') {
      var bgcolor = '#323232;';
      that.setData({
        backgroundcolor: bgcolor
      })
    } 
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {
    var that = this;
    //获取颜色配置
    app.getColorSetData(function (color) {
      that.setData({
        colorSet: color
      })
      that.resetNavColor();
    });

    this.animation = wx.createAnimation({
      // 动画持续时间，单位ms，默认值 400
      duration: 300,
      /**
       * http://cubic-bezier.com/#0,0,.58,1  
       *  linear  动画一直较为均匀
       *  ease    从匀速到加速在到匀速
       *  ease-in 缓慢到匀速
       *  ease-in-out 从缓慢到匀速再到缓慢
       * 
       *  http://www.tuicool.com/articles/neqMVr
       *  step-start 动画一开始就跳到 100% 直到动画持续时间结束 一闪而过
       *  step-end   保持 0% 的样式直到动画持续时间结束        一闪而过
       */
      timingFunction: 'linear',
      // 延迟多长时间开始
      delay: 0,
      /**
       * 以什么为基点做动画  效果自己演示
       * left,center right是水平方向取值，对应的百分值为left=0%;center=50%;right=100%
       * top center bottom是垂直方向的取值，其中top=0%;center=50%;bottom=100%
       */
      transformOrigin: 'center bottom 0',
    });
  },

  onShow: function(){
    //读取红包弹出广告信息
    this.loadHongbaoList();
    this.startTimer();
  },

  // 定时器
  startTimer: function () {
    var that = this;
    var timer = setTimeout(function () {
      var count = that.data.colorIndex + 1;
      that.setData({
        colorIndex: count
      })
      that.startTimer();
    }, 500);
  },

  onHide: function () {
    clearTimeout(timer);
  },

  resetNavColor: function(){
    var bg_color = '#d8202d';
    var fg_color = '#ffffff';

    if (this.data.colorSet) {
      var colorJO = this.data.colorSet;
      bg_color = colorJO.titlebg;
      fg_color = colorJO.titlefont;
    }
    wx.setNavigationBarColor({
      frontColor: fg_color,
      backgroundColor: bg_color
    })
  },

  getGoodsClassly: function () {
    //读取商品分类数据
    var that = this;
    util.api({
      data: {
        "publickey": util.publiccode,
        "ac": "goodstype",
        "tc": that.data.tc
      },
      success: function (responseData) {
        console.log("商品分类数据：", responseData.data);
        var goodsType = responseData.data;
        if (goodsType.msg) {
          wx.hideLoading();
        } else {
          that.setData({
            goodsTypeArray: goodsType
          })
          for (var i = 0; i < goodsType.length; i++) {
            that.loadFenleiGoodsData(goodsType[i], i);
          }
        }
      }
    });
  },


  //获取广告信息
  loadGuanggaoImage: function () {
    
      var that = this;
      var params = {
        "publickey": util.publiccode,
        "ac": "getadlist"
      };
      util.api({
        data: params,
        success: function (responseData) {
          console.log("广告数据：", responseData);
          var result = responseData.data;
          if (result && result.length > 0) {
            for(var i = 0; i < result.length; i++){
              var gdData = result[i];
              var key = "guanggao" + gdData.id;//本地缓存key
              var count = parseInt(gdData.preday ? gdData.preday : '1');//每天最大显示次数
              var startTime = parseInt(gdData.stime);//开始显示时间
              var endTime = parseInt(gdData.etime);//结束显示时间
              var curTime = parseInt(new Date().getTime() / 1000);
              if (startTime <= curTime && curTime <= endTime  //在规定时段内显示
                && parseInt(gdData.coinnum) > 0  //广告点数还没用完
                && app.getShowGuanggaoSign(key, count)) {//今天还有显示额度
                //广告
                result[i].key = key;
                that.setData({
                  guanggao_link: result[i]
                });
                break;
              }
            }
          }
        }
      });
    
  },

  //获取红包列表信息
  loadHongbaoList: function () {
    var that = this;
    var params = {
      "publickey": util.publiccode,
      "ac": "hongbaolist",
      "uid": util.orgid,
    };
    util.api({
      data: params,
      success: function (responseData) {
        var result = responseData.data;
        console.log("红包列表信息：", result);
        if (result && result.length > 0) {
          var time = parseInt((new Date().getTime()) / 1000);
          if (time <= result[0].endtime) {
            that.setData({
              hongbaoInfo: result[0],
              curTime: time,
            })
            if (time >= result[0].starttime && time <= result[0].endtime) {
              that.setData({
                guanggao_link: result[0]
              })
            } else {
              that.loadGuanggaoImage();
            }
          } else {
            that.loadGuanggaoImage();
          }
          
        } else {
          that.loadGuanggaoImage();
        }
      }
    });
  },

  imageLoaded: function(e){
    var that = this;
    var data = e.currentTarget.dataset.info;
    var showTime = parseInt(data.showtime);
    setTimeout(function () {
      that.animation.translateY(-that.data.screen_h).step();
      that.setData({
        animation: that.animation.export(),
      })
      //计费
      if (that.data.loginuid && that.data.token) {//登录用户才计费
        that.adcoindown(data.id);
      }
    }, showTime);

    this.animation.translateY(this.data.screen_h).step();
    that.setData({
      animation: this.animation.export(),
    });
    //更新广告显示标识
    console.log("更新广告标识：", data);
    app.setShowGuanggaoSign(data.key);
    
  },

  //扣除广告费用
  adcoindown: function (adid){
    // 请求类型：post
    // 参数：ac - adcoindown标识接口
    // id - 广告id
    // downcoin - 扣除计费点数数值
    // 返回数据：res - true成功 false- 失败
    var that = this;
    var privatekey = utilMd5.hexMD5(this.data.loginuid + 'adcoindown' + this.data.token);
    var params = {
      ac: "adcoindown",
      privatekey: privatekey,
      uid: this.data.loginuid,
      id: adid,
      downcoin: 1
    };
    util.api({
      data: params,
      method: 'POST',
      success: function (responseData) {
        console.log('扣除广告费用点数: ', responseData);
      }
    });
  },

//index 001  幻灯片数据
  loadSwiperImage: function(index){
    var that = this;
    var params = {
      "publickey": util.publiccode,
      "ac": "indexslide",
      "uid": util.orgid,
      "block": index,
      "tc": that.data.tc
    };
    util.api({
      data: params,
      success: function (responseData) {
        console.log(index + "-- swiper image:", responseData);
        var result = responseData.data;
        if (result && result.length > 0) {
          if (index == 2) {
            result.forEach(function (m, i) {
              var col = parseInt(m.col);
              col = col == 0 ? 1 : col;
              result[i].img_w = screen_w / col;
              console.log("顶图宽：" + m.img_w + "; col = " + col);
            });
            that.setData({
              logo_urls: result
            })
          } else if (index == 3) {
            var colCount = result[0].col == '0' ? 4 : parseInt(result[0].col);
            var topItem_w = (screen_w - 24) / colCount;
            that.setData({
              top_menu_item_w: topItem_w,
              topmenuInfos: result,
              top_menu_bg_color: result[0].bgcolor ? result[0].bgcolor : '#fafafa',
            });
          } else if(index == 1){
            that.setData({
              swiperImgUrls: result
            });
          } else if (index == 10) {
            that.setData({
              swiperImgUrls2: result
            });
          } 
          // else if (index == 11) {
          //   that.setData({
          //     swiperImgUrls3: result
          //   });
          // }
            else if (index == 4) {
            var item_data = result[0];
            var colCount = item_data.col == '0' ? 1 : parseInt(item_data.col);
            var w_h = (screen_w - (colCount + 1) * 5) / colCount;
            item_data.w_h = w_h;
            that.setData({
              jingxuanOb: item_data
            })
            that.loadGoodsListData(0, 1);
          } else if (index == 5) {
            var item_data = result[0];
            var colCount = item_data.col == '0' ? 1 : parseInt(item_data.col);
            var w_h = (screen_w - (colCount + 1) * 7) / colCount;
            item_data.w_h = w_h;
            that.setData({
              tuijianOb: item_data
            })
            that.loadGoodsListData(1, 0);
          } else if (index == 6) {
            var item_data = result[0];
            var colCount = item_data.col == '0' ? 1 : parseInt(item_data.col);
            var w_h = (screen_w - (colCount + 1) * 7) / colCount;
            item_data.w_h = w_h;
            that.setData({
              xinpinOb: item_data
            })
            that.loadGoodsListData(0, 0);
          } else if (index == 7) {
            var item_data = result[0];
            var colCount = item_data.col == '0' ? 1 : parseInt(item_data.col);
            var w_h = (screen_w - (colCount + 1) * 7) / colCount;
            item_data.w_h = w_h;
            that.setData({
              fenleiOb: item_data
            })
            //读取商品分类数据
            that.getGoodsClassly();
          } else if (index == 8) {//门店
            that.setData({
              shopViewName: result[0].navtitle,
              mendian_data: result
            });
          } else if (index == 11) {
            result.forEach(function (m, i) {
              var col = parseInt(m.col);
              col = col == 0 ? 1 : col;
              result[i].img_w = screen_w / col;
              console.log("贴图宽：" + m.img_w + "; col = " + col);
            });
            that.setData({
              tietu_urls: result
            })
          }else if (index == 12) {
            console.log(result);
             result.forEach(function (m, i) {
              var col = parseInt(m.col);
              col = col == 0 ? 1 : col;
              result[i].img_w = screen_w / col;
              console.log("贴图宽：" + m.img_w + "; col = " + col);
            });
            
            var AbanList = [];
            var BbanList = [];
            var guojibanList = [];
            for (var i = 0; i < result.length; i++) {
                if(result[i]['gtype'] == '294340'){
                  AbanList.push(result[i]);
                }else if(result[i]['gtype'] == '294341'){
                  BbanList.push(result[i]);
                }else if(result[i]['gtype'] == '294343'){
                  guojibanList.push(result[i]);
                }
            }

            that.setData({
              zixunfenlei: AbanList,
              AbanList: AbanList,
              BbanList:BbanList,
              guojibanList:guojibanList
            })
          } else if (index == 13) {
            that.setData({
              gonggaoList: result
            })
          }
        }
        wx.hideLoading();
      }
    });
  },

  swiperAction: function (e) {
    var data = e.currentTarget.dataset.info;
    app.saveFormId(e.detail.formId);
    console.log("swiper data:", data);
    if (data) {
      var go_type = data.type;
      var go_id = data.data;
      if (go_type == "topic") {//去详情页
        var url = "/pages/detail/detail?topicid=" + go_id;
        wx.navigateTo({ url: url })
      } else if (go_type == "url") {
        var url = go_id;
        if (url.indexOf('/pages/') >= 0) {
          wx.navigateTo({ url: url })
        } else if (url.indexOf('showToast') >= 0){
          this.pindanAction();
        } else {
          // app.dialog('未定义跳转' + url, 'success');
        }
      } else {
        // app.dialog('未定义跳转：' + go_type + '--' + go_id, 'success');
      }
    }
  },
  
  //广告图响应动作
  guanggaoAction: function (e) {
    var data = e.currentTarget.dataset.info;
    if (data) {
      var go_type = data.linktype;
      var link = data.linkurl;
      console.log("go_type = " + go_type + "; link = " + link);
      if (go_type == "0" && link) {//去详情页
        var url = "/pages/detail/detail?topicid=" + link;
        console.log("跳到详情页面 url = " + url + "; link = " + link);
        wx.navigateTo({ url: url })
      } else if (go_type == "1" && link.indexOf('/pages/') >= 0) {
        console.log("跳到自定义页面 link = " + link);
        wx.navigateTo({ url: link })
      }
    }
  },

  loadFenleiGoodsData: function (goodsTypeOb, index) {
    var that = this;
    var goodsId = goodsTypeOb.goods_id;
    var params = {
      publickey: util.publiccode,
      ac: "topiclist",
      topictype: '4',
      toporder: '1',
      tc: that.data.tc,
      orgid: util.orgid,
      gtype: goodsId,
      zhiding: '1',
      page: 1,
      num: 10
    };
    console.log("商品参数：", params);
    util.api({
      data: params,
      success: function (responseData) {
        var result = responseData.data;
        console.log("商品数据" + goodsId + ": ", result);
        if (result.msg) {
          goodsTypeOb.goodsArray = [];
          goodsTypeOb.noData = true;
        } else {
          var count = result.length;
          result.forEach(function (m, i) {
            result[i].count = count;
          });
          goodsTypeOb.goodsArray = result;
          goodsTypeOb.noData = false;
        }
        var goodsTypeArr = that.data.goodsTypeArray;
        goodsTypeArr[index] = goodsTypeOb;
        that.setData({
          goodsTypeArray: goodsTypeArr
        })
        wx.hideLoading();
      }
    });
  },

  loadGoodsListData: function (zhiding, jingxuan) {
    var that = this;
    var params = {
      publickey: util.publiccode,
      ac: "topiclist",
      topictype: '4',
      tc: that.data.tc,
      orgid: util.orgid,
      zhiding: zhiding,
      shopgoodscata: jingxuan,
      page: 1,
      num: 4
    };

    // console.log("商品请求参数：", params);
    util.api({
      data: params,
      success: function (responseData) {
        console.log("zhiding:" + zhiding + "; shopgoodscata:" + jingxuan);
        console.log("商店商品数据:", responseData);
        var resData = responseData.data;
        if (!resData.msg) {
          if (zhiding == 1){//热销推荐
            that.setData({
              tuijianData: resData
            })
          } else if (jingxuan == 1) {//精选
            that.setData({
              djJingxuanData: resData
            })
          } else { //新品上市
            that.setData({
              xinpin_data: resData
            })
          }
        }
        
        wx.hideLoading();
      }
    });
  },
  

  goAtherPage: function(e){
      app.saveFormId(e.detail.formId);
      var url = e.currentTarget.dataset.link;
      wx.navigateTo({url: url})
  },
  goAtherPageRedirect: function(e){
      app.saveFormId(e.detail.formId);  
      var url = e.currentTarget.dataset.link;
      wx.redirectTo({url: url})
  },
  //页面分享
  onShareAppMessage: function () {
    var that = this;
    var inviteuid = that.data.loginuid ? that.data.loginuid : '';
    console.log("分享id" + inviteuid);
    return {
      title: '我为鞋狂！学生凭准考证，可折上折，欢迎来抽！',
      path: '/pages/shoes-index/shoes-index?&inviteuid=' + inviteuid
    };
  },
  

  showEWM: function (e) {
    var shareImgUrl = e.currentTarget.dataset.imgsrc;
    console.log("图片链接：" + shareImgUrl);
    wx.previewImage({
      current: shareImgUrl,
      urls: [shareImgUrl]
    })
  },

  //保存formId
  submitFormId: function (e) {
    app.saveFormId(e.detail.formId);

    var path = e.detail.value.nav_path;
    if (path.indexOf('navto:') == 0) {
      var navPath = path.slice(6);
      wx.navigateTo({
        url: navPath,
      })
    } else {
      wx.redirectTo({ url: path });
    }

    path = e.detail.value.page_path;
    if (path) {
      wx.navigateTo({ url: path });
    }
  },

  makeCallPhone:function(e) {
    app.saveFormId(e.detail.formId);
    var phoneNum = e.currentTarget.dataset.number;
    console.log("phoneNum:" + phoneNum);
    wx.makePhoneCall({
      phoneNumber: phoneNum,
      success:function(e){
        console.log("make call success:", JSON.stringify(e));
      },
      fail:function(e){
        console.log("make call fail:", JSON.stringify(e));
      }
    })
  },

  goHongbaoPage: function(e){
    var hb_info = e.currentTarget.dataset.info;
    var hongbaoId = hb_info.hongbaoid;
    var path = "/pages/hongbao/hongbao?hongbaoid=" + hongbaoId + "&shareuid=" + util.orgid;
    wx.navigateTo({
      url: path,
    })
  },

  goMapView: function (e) {
    var lat = 23.010426;
    var lon = 113.096518;
    var tc = this.data.tc;
    wx.openLocation({
      latitude: lat,
      longitude: lon,
      scale: 18,
      name: tc == 1 ? '煌圖廣告' :'煌图广告',
      address: tc == 1 ? '佛山市禪城區季華四路盈科億家陶瓷衛浴世界東區B2座三樓322號' : '佛山市禅城区季华四路盈科亿家陶瓷卫浴世界东区B2座三楼322号',
    })
  },
  goMapViewZeai: function (e) {
    var lat = 22.184101;
    var lon = 113.555919;
    // 22.184101, 113.555919
    var tc = this.data.tc;
    wx.openLocation({
      latitude: lat,
      longitude: lon,
      scale: 18,
      name: tc == 1 ?'澤愛托兒所':'泽爱托儿所',
      address: tc == 1 ? '澳門新口岸栢嘉街490號帝景苑地下BL' : '澳门新口岸栢嘉街490号帝景苑地下BL',
    })
  },


  //点击咨询分类的菜单A班
  changeAban:function(){
    var that = this;
    var style = "font-weight:bold;color:#4595FD;";
    that.setData({
      zixunfenlei:that.data.AbanList,
      fenlei0class: style,
      fenlei1class: '',
      fenlei2class: '',

      line0: "height:8rpx;",
      line2: "",
      line3: "",
    })
  },

  //点击咨询分类的菜单B班
  changeBban:function(){
    var that = this;
    var style = "font-weight:bold;color:#4595FD;";
    that.setData({
      zixunfenlei:that.data.BbanList,

      fenlei0class: '',
      fenlei1class: style,
      fenlei2class: '',

      line0: "",
      line2: "height:8rpx;",
      line3: "",

    })
  },

  //点击咨询分类的菜单A班
  changeGuojiban:function(){
    var that = this;
    var style = "font-weight:bold;color:#4595FD;";
    that.setData({
      zixunfenlei:that.data.guojibanList,
      fenlei0class: '',
      fenlei1class: '',
      fenlei2class: style,

      line0: "",
      line2: "",
      line3: "height:8rpx;",
    })
  },
  //点击更多的商品
  moregoods: function (e) {
    console.log(e.currentTarget.dataset.id);
    var goodsId = e.currentTarget.dataset.id;
    var path = "/pages/clothing-loadmore/clothing-loadmore?goodsId=" + goodsId;
    wx.navigateTo({
      url: path,
    })
  },
  
})
